<template>
  <!-- van-cell单元格插件
          icon左边图标
          title左边标题
          value:右边内容
          is-link右边箭头,布尔值true代表显示
          center垂直居中
          slot: title/icon/default(右边内容的插槽是default)-->
  <van-cell class="my_cell" is-link center @click="cellClick" >
    <template #icon>
      <!-- 注意这里的icon要v-html去解析 -->
      <i class="iconfont f22" v-html="icon"></i>
    </template>
    <template #title>
      <div class="title">{{ title }}</div>
    </template>
    <template #default>
      <!-- <img class="img" v-if="type === 'img'&&value" :src="$baseUrl + value" alt="" />
        <img class="img" v-else-if="type === 'img'&&!value" src="../../../assets/logo.png" alt="" /> -->
      <div v-if="type === 'img'">
        <img class="img" v-if="value" :src="$baseUrl + value" alt="" />
        <img class="img" v-else src="../../../assets/logo.png" alt="" />
      </div>
      <div v-else class="value">{{ value }}</div>
    </template>
  </van-cell>
</template>
<script>
export default {
  // 接收父组件传值
  props: ['title', 'value', 'icon', 'type'],
  data () {
    return {}
  },
  methods: {
    cellClick () {
      this.$emit('click')
    }
  }
}
</script>
<style lang="less">
.my_cell {
  //   background-color: #fff;
  .f22 {
    font-size: 22px;
    padding-right: 12px;
  }
  .title {
    font-size: 14px;
    font-family: PingFangSC, PingFangSC-Regular;
    font-weight: 400;
    text-align: left;
    color: #181a39;
    line-height: 20px;
    letter-spacing: 0px;
  }
  .value {
    font-size: 14px;
    font-family: PingFangSC, PingFangSC-Regular;
    font-weight: 400;
    text-align: right;
    color: #5b5d75;
    line-height: 20px;
    letter-spacing: 0px;
  }
  .img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
  }
}
</style>
